import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '学生pin',
    align: "center",
    dataIndex: 'pin'
  },
  {
    title: '主叫号码',
    align: "center",
    dataIndex: 'billcaller'
  },
  {
    title: '被叫号码',
    align: "center",
    dataIndex: 'billcalled'
  },
  {
    title: '号码类别',
    align: "center",
    dataIndex: 'calltype'
  },
  {
    title: '通话类型',
    align: "center",
    dataIndex: 'billcalltype'
  },
  {
    title: '通话开始',
    align: "center",
    dataIndex: 'start'
  },
  {
    title: '通话结束',
    align: "center",
    dataIndex: 'end'
  },
  {
    title: '通话时长，单位秒',
    align: "center",
    dataIndex: 'duration'
  },
  {
    title: '话费',
    align: "center",
    dataIndex: 'phonebill'
  },
  {
    title: '创建时间',
    align: "center",
    dataIndex: 'createtime'
  },
  {
    title: '学生姓名',
    align: "center",
    dataIndex: 'realname'
  },
  {
    title: '卡号',
    align: "center",
    dataIndex: 'cardid'
  },
  {
    title: '设备SN',
    align: "center",
    dataIndex: 'devicesn'
  },
  {
    title: '扣费状态 扣费状态:未扣费，扣费失败，已扣费',
    align: "center",
    dataIndex: 'deductionstatus'
  },
  {
    title: '学校组织ID',
    align: "center",
    dataIndex: 'organizationid'
  },
  {
    title: '班级/部门id',
    align: "center",
    dataIndex: 'departmentid'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建日期",
    field: "createTime1",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "学生姓名",
    field: 'realname',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '学生pin',
    field: 'pin',
    component: 'Input',
  },
  {
    label: '主叫号码',
    field: 'billcaller',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入主叫号码!'},
             ];
    },
  },
  {
    label: '被叫号码',
    field: 'billcalled',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入被叫号码!'},
             ];
    },
  },
  {
    label: '号码类别',
    field: 'calltype',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入号码类别!'},
             ];
    },
  },
  {
    label: '通话类型',
    field: 'billcalltype',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入通话类型!'},
             ];
    },
  },
  {
    label: '通话开始',
    field: 'start',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入通话开始!'},
             ];
    },
  },
  {
    label: '通话结束',
    field: 'end',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入通话结束!'},
             ];
    },
  },
  {
    label: '通话时长，单位秒',
    field: 'duration',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入通话时长，单位秒!'},
             ];
    },
  },
  {
    label: '话费',
    field: 'phonebill',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入话费!'},
             ];
    },
  },
  {
    label: '创建时间',
    field: 'createtime',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入创建时间!'},
             ];
    },
  },
  {
    label: '学生姓名',
    field: 'realname',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入学生姓名!'},
             ];
    },
  },
  {
    label: '卡号',
    field: 'cardid',
    component: 'Input',
  },
  {
    label: '设备SN',
    field: 'devicesn',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入设备SN!'},
             ];
    },
  },
  {
    label: '扣费状态 扣费状态:未扣费，扣费失败，已扣费',
    field: 'deductionstatus',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入扣费状态 扣费状态:未扣费，扣费失败，已扣费!'},
             ];
    },
  },
  {
    label: '学校组织ID',
    field: 'organizationid',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入学校组织ID!'},
             ];
    },
  },
  {
    label: '班级/部门id',
    field: 'departmentid',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  pin: {title: '学生pin',order: 1,view: 'text', type: 'string',},
  billcaller: {title: '主叫号码',order: 2,view: 'text', type: 'string',},
  billcalled: {title: '被叫号码',order: 3,view: 'text', type: 'string',},
  calltype: {title: '号码类别',order: 4,view: 'number', type: 'number',},
  billcalltype: {title: '通话类型',order: 5,view: 'text', type: 'string',},
  start: {title: '通话开始',order: 6,view: 'text', type: 'string',},
  end: {title: '通话结束',order: 7,view: 'text', type: 'string',},
  duration: {title: '通话时长，单位秒',order: 8,view: 'number', type: 'number',},
  phonebill: {title: '话费',order: 9,view: 'text', type: 'string',},
  createtime: {title: '创建时间',order: 10,view: 'text', type: 'string',},
  realname: {title: '学生姓名',order: 11,view: 'text', type: 'string',},
  cardid: {title: '卡号',order: 12,view: 'text', type: 'string',},
  devicesn: {title: '设备SN',order: 13,view: 'text', type: 'string',},
  deductionstatus: {title: '扣费状态 扣费状态:未扣费，扣费失败，已扣费',order: 14,view: 'text', type: 'string',},
  organizationid: {title: '学校组织ID',order: 15,view: 'number', type: 'number',},
  departmentid: {title: '班级/部门id',order: 16,view: 'number', type: 'number',},
};
